﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace GeneralClasses
{
    /// <summary>
    /// reads text files for you
    /// </summary>
    public abstract class FileDealer
    {
        //---------------------------------------------------------------
        //                                                           READ
        //---------------------------------------------------------------

      

        public static List<String> readFile(String filename) {
            List<String> lines = new List<String>();

            TextReader tr = new StreamReader(filename);
            String temp;

            while((temp=tr.ReadLine())!=null){
                lines.Add(temp);
            }
            
            tr.Close();

            return lines;
        }//end fileReader


        //---------------------------------------------------------------
        //                                                          WRITE
        //---------------------------------------------------------------

        public static void writeFile(String filename, List<String> list) {
            TextWriter tw = new StreamWriter(filename);

            foreach (String s in list) {
                tw.WriteLine(s);
            }

            tw.Close();
        } // end fileWriter

    }
}
